# $Id$
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=json-glib
pkgver=1.4.2
pkgrel=1
pkgdesc="JSON library built on GLib"
url="https://wiki.gnome.org/Projects/JsonGlib"
arch=(i686 x86_64)
license=(GPL)
depends=(glib2)
makedepends=(gobject-introspection git gtk-doc meson)
_commit=68e90dafac7022fc467bac8d2dd04d3f8a5a88a7  # tags/1.4.2^0
source=("git+https://gitlab.gnome.org/GNOME/json-glib.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  mkdir build
  cd $pkgname
}

build() {
  cd build
  meson setup --prefix=/usr --buildtype=release ../$pkgname \
    --libexecdir=/usr/lib -Ddocs=true
  ninja
}

check() {
  cd build
  meson test || [[ $CARCH == i686 ]]
}

package() {
  cd build
  DESTDIR="$pkgdir" ninja install
}
